import { createApp } from 'vue'
import './style.scss'
import App from './App.vue'
import hljs from 'highlight.js'
import 'highlight.js/styles/github-dark.css' // 选择高亮主题

const app = createApp(App)

// 创建自定义指令 v-highlight
app.directive('highlight', {
    mounted(el) {
      const blocks = el.querySelectorAll<HTMLElement>('pre code')
      blocks.forEach(block => hljs.highlightElement(block))
    },
    updated(el) {
      const blocks = el.querySelectorAll<HTMLElement>('pre code')
      blocks.forEach(block => hljs.highlightElement(block))
    }
  })

app.mount('#app')
